package net.kazed.nextaction.context.activity;

import net.kazed.nextaction.R;
import net.kazed.nextaction.database.GtdContext;
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ExpandableContextView extends LinearLayout {

   private TextView name;
   private TextView taskCount;
   
	public ExpandableContextView(Context androidContext) {
      super(androidContext);
      
      LayoutInflater vi = (LayoutInflater) androidContext.
          getSystemService(android.content.Context.LAYOUT_INFLATER_SERVICE);
      vi.inflate(R.layout.context_tree_item, this, true); 
      
    name = (TextView) findViewById(R.id.name);
    taskCount = (TextView) findViewById(R.id.number_of_tasks);
	}
	
	protected int getViewResourceId() {
		return R.layout.context_tree_item;
	}

   public void updateView(GtdContext context) {
      name.setText(context.getName());
      taskCount.setText(Integer.toString(context.getNumberOfTasks()));
   }
}
